home *** CD-ROM | disk | FTP | other *** search
- {****************************************************}
- { CResFile.p}
- {}
- { The Resource File Class}
- {}
- { SUPERCLASS = CFile}
- {}
- { Copyright ⌐ 1989, Symantec Corporation. All rights reserved. }
- {}
- {****************************************************}
-
- unit CResFile;
-
- interface
-
- uses
- TCL, MoreTCL;
-
- implementation
-
-
-
- {*** C O N S T R U C T I O N / D E S T R U C T I O N M E T H O D S ***}
-
-
-
- {****************************************************}
- { IResFile}
- {}
- { Initialize a ResFile object}
- {}
- {****************************************************}
-
- procedure CResFile.IResFile;
- begin
- IFile;
- refNum := 0;
- end;
-
-
- {****************************************************}
- { Open (OVERRIDE)}
- {}
- { Open the resource fork of a file with the specified access permission.}
- { Opening the file automatically makes it the current resource file.}
- {}
- {****************************************************}
-
- function CResFile.Open (permission: SignedByte): OSErr;
- begin
-
- { Altered by TCL Weaver 1.0 (5/11/90) }
-
- refNum := HOpenResFile(volNum, dirID, name, permission);
-
- if refNum = -1 then
- refNum := 0;
- Open := ResError;
- end;
-
-
- {****************************************************}
- { Close (OVERRIDE)}
- {}
- { Close a File and make sure contents are written to disk}
- {}
- {****************************************************}
-
- function CResFile.Close: OSErr;
- begin
- if refNum > 0 then
- begin
- CloseResFile(refNum);
- refNum := 0;
- Close := FlushVol(nil, volNum);
- end
- else
- Close := fnOpnErr;
- end;
-
-
- {****************************************************}
- { MakeCurrent}
- {}
- { Make this the current resource file}
- {}
- {****************************************************}
-
- procedure CResFile.MakeCurrent;
- begin
- UseResFile(refNum);
- end;
-
-
- end.